<?php

/**
 * 验证码处理
 */
namespace Api\Controller;
use Think\Controller;
class UserController extends Controller {

    //登录验证
    function dologin(){
    	    	
    	$users_model=M("Users");    	
    	$mobile=I('post.mobile');
		//dump($mobile);
		$user_pass=I('post.user_pass');
		$where['mobile'] = $mobile;
		$result = $users_model->where($where)->find();
		if(!empty($result)){
            if(sp_compare_password($user_pass, $result['user_pass'])){
                //$_SESSION["user"]=$result;
                //写入此次登录信息
                $data['status'] = 1;
				$data['mobile'] = $result['mobile'];
				$data['user_nicename'] = $result['user_nicename'];
                $this->ajaxReturn($data,'json');
            }else{
				$data['status'] = 0;
                $this->ajaxReturn($data,'json');
            }
        }else{
			$data['status'] = -1;			
            $this->ajaxReturn($data,'json');
        }		
    }
}

